Skip to content

fix(route-proxy): collect chat-completions bodies as bytes with 50MB cap (#4335) - #4603

Closed
dezren39 wants to merge 1 commit into
mainfrom
queue/6410-4335-proxy-body
Closed

dezren39 wants to merge 1 commit into
mainfrom
queue/6410-4335-proxy-body

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Summary

chat-completions body: createRequestBodyCollector (bytes + 50MB cap, decode once)
removes per-chunk string coercion; oversize bodies get 413

Fixes #4335.

Evidence

  • node --test bin/opencode-route-proxy.test.mjs — 27 passed, 0 failed (includes 2 new regression tests).
  • New split-chunk test fails on pre-fix code with the issue's exact signature (caf�� �� fin) and passes with the fix.
  • New 413 test: 51MB body rejected with 413.
  • No other per-chunk request-body string coercion remains in bin/opencode-route-proxy.mjs (single raw += site replaced).

Merge Danger

Door: one-way

Blast Radius: low

Only the /v1/chat/completions body-read path changes; valid requests behave identically apart from intact multibyte content. Cap matches the sibling proxies (50MB, same shared collector from PR #4322).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…cap (#4335)

Collect the request body via the shared createRequestBodyCollector
from bin/request-body.mjs: bytes are buffered with a 50MB cap (413
past it) and decoded as UTF-8 once, instead of per-chunk string
coercion that corrupted multibyte characters split across chunks.

Regression tests: split-chunk multibyte body arrives intact; 51MB
body is rejected with 413.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 22:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T22:01:51.972441Z c56ffdd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 76eeb55b-a290-4c1b-8c54-73db95c40333
Commits

Reviewing files that changed from the base of the PR and between 12da950 and c56ffdd.

Files selected for processing: 2
  • bin/opencode-route-proxy.mjs
  • bin/opencode-route-proxy.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39

dezren39 commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

Closing as obsolete — salvage note (per duplicate/obsolete PR protocol):

  • Canonical state: current origin/main (281e2eae) — commit e8b4cdc754 ("rewire OpenClaw to the server facade and retire the route proxy (opencode#1153)") deleted bin/opencode-route-proxy.mjs and bin/opencode-route-proxy.test.mjs, the only two files this PR touches. The PR's base file no longer exists, so the change cannot land.
  • Salvage diff vs canonical: this PR's approach — collect the chat-completions body via the shared createRequestBodyCollector with a 50 MB cap and 413 past the cap, plus split-chunk/oversize regression tests — contains nothing unique to salvage: the collector and cap pattern are already canonical in bin/request-body.mjs for the surviving proxies, and the tests target a deleted test file for a retired proxy.
  • Issue opencode-route-proxy: request body decoded per chunk — multibyte UTF-8 split across chunks reaches the leaf as U+FFFD (the #3186 fix missed this proxy; also no body size cap) #4335 is being closed the same pass as superseded by the retirement, with the full evidence trail on the issue (triage task 12153, lane code-c).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant